<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//路由文件

Route::get('/', function () {
    return view('welcome');
});

Route::get('/a',function(){
	return view('form');
});

Route::post('/test',function(){
	echo '提交成功';
});

Route::get('/ajax',function(){
	return view('test.ajax1');
});

Route::post('/test',function(){
	var_dump($_POST);
});

Route::get('/good/{id}',function($id){
	echo '商品ID'.$id;
})->where('id','\d{1,2}');

Route::get('/good-{id}/{name}',function(){
	echo '123';
});

Route::get('/a/b/c',[
	'as'=>'abc',
	function(){
		// return route('abc');//返回的是url
		// return url('a/b/c');
		echo env('APP_KEY');
		// return Route::currentRouteName();//返回路由规则 别名
	}	
	]);

Route::group(['middleware'=>'login'],function(){
	Route::get('/admin',function(){
		echo '后台';
	});
	Route::get('/home',function(){
		echo '前天';
	});
});

Route::get('/test3',function(){
	echo '单个使用中间件';
})->middleware('login');

Route::get('/test5',['middleware'=>'login',function(){
	echo 'aaaaaaa';
}]);

Route::controller('/good','GoodController');

Route::get('/request/upload','RequestController@upload');

Route::controller('/request','RequestController');















